import { addIp } from '@/api/frontend/ip'
import axios from "axios"
import { defineStore } from 'pinia'
import { ref } from 'vue'
// 通过其他网站查询用户ip

export const useIpStore = defineStore('ip', () => {
    const ipInfo = ref({})
    function setIp() {
        axios.get("https://ip.useragentinfo.com/json?ip=").then(res => {
            console.log(res.data);
            ipInfo.value = res.data;
            addIp(res.data);
        });
    }

    return {
        ipInfo, setIp
    }
})
